package com.yhsimon.principle._3_dependence_inversion.improve;

public class DependencyInversion {
    public static void main(String[] args) {
        Person person = new Person();
        person.receive(new Email());
        person.receive(new WeChat());
    }
}
interface IReceiver{
    public String getInfo();
}
class Email implements IReceiver{
    public String getInfo(){
        return "email info: hello ,world!";
    }
}

class WeChat implements  IReceiver{
    @Override
    public String getInfo() {
        return "WeChat info:hello ,world!";
    }
}
class Person{
    //这里我们是对接口的依赖
    public void receive(IReceiver receiver){
        System.out.println(receiver.getInfo());
    }
}